package Springboot.Controller;

import Springboot.Utils.Result;
import Springboot.domain.NewsType;
import Springboot.domain.NewsUser;
import Springboot.service.impl.NewsUserServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("user")
public class NewsUserController {
    @Autowired
    NewsUserServiceImpl newsUserService;

    @PostMapping("login")
    public Result login(@RequestBody NewsUser user) {
        Result result=newsUserService.login(user);
        return result;
    }
    @GetMapping("getUserInfo")
    public Result getUserInfo(@RequestHeader String token) {
        Result result=newsUserService.getUserInfo(token);
        return result;
    }
    @PostMapping("checkUserName")
    public Result checkUserName(String username) {
        Result result=newsUserService.checkUserName(username);
        return result;
    }

    @PostMapping("regist")
    public Result regist(@RequestBody NewsUser newsUser) {
        Result result=newsUserService.regist(newsUser);
        return result;
    }
    @GetMapping("checkLogin")
    public Result checkLogin(@RequestHeader String token) {
        Result result= newsUserService.checkLogin(token);
        return result;
    }
}
